import { IPSDELogic } from './ipsdelogic';
import { IPSDELogicParam } from './ipsdelogic-param';
import { IPSDERawWebCallLogic } from './ipsderaw-web-call-logic';
import { PSDELogicNodeImpl } from './psdelogic-node-impl';
import { IPSSubSysServiceAPI } from '../../service/ipssub-sys-service-api';

export class PSDERawWebCallLogicImpl extends PSDELogicNodeImpl implements IPSDERawWebCallLogic {
  get bodyContentType(): 'application/json' | 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/xml' | 'USER' | 'USER2' | 'USER3' | 'USER4' {
    return this.M.bodyContentType;
  }

  protected dstpsdelogicparam: IPSDELogicParam | null = null;

  getDstPSDELogicParam(): IPSDELogicParam | null {
    if (this.dstpsdelogicparam != null) return this.dstpsdelogicparam;
    const value = this.M.getDstPSDELogicParam;
    if (value == null) {
      return null;
    }
    const ipsdelogic = this.getParentPSModelObject('dataentity.logic.IPSDELogic') as IPSDELogic;
    if (ipsdelogic != null) {
      this.dstpsdelogicparam = ipsdelogic.findPSDELogicParam(value);
    }
    return this.dstpsdelogicparam;
  }

  get dstPSDELogicParam(): IPSDELogicParam | null {
    return this.getDstPSDELogicParam();
  }

  getDstPSDELogicParamMust(): IPSDELogicParam {
    const value = this.getDstPSDELogicParam();
    if (value == null) {
      throw new Error('未指定目标逻辑参数对象');
    }
    return value;
  }

  protected pssubsysserviceapi: IPSSubSysServiceAPI | null = null;

  getPSSubSysServiceAPI(): IPSSubSysServiceAPI | null {
    if (this.pssubsysserviceapi != null) return this.pssubsysserviceapi;
    const value = this.M.getPSSubSysServiceAPI;
    if (value == null) {
      return null;
    }
    this.pssubsysserviceapi = this.getPSModel4('service.IPSSubSysServiceAPI', value, 'getPSSubSysServiceAPI') as IPSSubSysServiceAPI;
    return this.pssubsysserviceapi;
  }

  get psSubSysServiceAPI(): IPSSubSysServiceAPI | null {
    return this.getPSSubSysServiceAPI();
  }

  getPSSubSysServiceAPIMust(): IPSSubSysServiceAPI {
    const value = this.getPSSubSysServiceAPI();
    if (value == null) {
      throw new Error('未指定外部服务接口');
    }
    return value;
  }

  get requestMethod(): 'GET' | 'HEAD' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'TRACE' {
    return this.M.requestMethod;
  }

  get requestPath(): string {
    return this.M.requestPath;
  }

  protected retpsdelogicparam: IPSDELogicParam | null = null;

  getRetPSDELogicParam(): IPSDELogicParam | null {
    if (this.retpsdelogicparam != null) return this.retpsdelogicparam;
    const value = this.M.getRetPSDELogicParam;
    if (value == null) {
      return null;
    }
    const ipsdelogic = this.getParentPSModelObject('dataentity.logic.IPSDELogic') as IPSDELogic;
    if (ipsdelogic != null) {
      this.retpsdelogicparam = ipsdelogic.findPSDELogicParam(value);
    }
    return this.retpsdelogicparam;
  }

  get retPSDELogicParam(): IPSDELogicParam | null {
    return this.getRetPSDELogicParam();
  }

  getRetPSDELogicParamMust(): IPSDELogicParam {
    const value = this.getRetPSDELogicParam();
    if (value == null) {
      throw new Error('未指定返回值绑定逻辑参数对象');
    }
    return value;
  }

  get returnRepEntity(): boolean {
    return this.M.returnRepEntity != null ? this.M.returnRepEntity : false;
  }

  get cls(): string {
    return 'PSDERawWebCallLogicImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'dataentity.logic.IPSDERawWebCallLogic') return true;
    return super.instanceof(cls);
  }
}
